<?php

/**
 * [2025]
 *
 * @package 2025
 * @author shean
 * @version 2025-09
 * @link http://doubao.life
 */
ini_set('opcache.revalidate_freq', 0);
if (!defined('__TYPECHO_ROOT_DIR__'))
    exit;
$data = getBingToday();
$cate = array_reverse($data['month']);
?>
<!DOCTYPE HTML>
<html lang="zh-cn">

    <head>
        <?php $this->need('header.php'); ?>
    </head>

    <body class="bg-tran">
        <div class="container" style="padding:15px;">
            <?php if ($this->fields->isPhoto === 'no'): //普通博文 ?>
                <div class="columns">
                    <div class="column col-6 col-sm-12 cont" style="margin:0 auto;">
                        <div class="postBody-before">
                            <div class="postBody-header">
                                <div style="flex:1;"></div>
                                <div class="text-small"><?php $this->date('Y年m月d日'); ?></div>
                            </div>
                        </div>
                        <div class="postBody">
                            <?php if ($this->fields->repost !== '')://有转载信息 ?>
                                <div style="padding:10px;margin:10px;" class="text-small">
                                    <?php echo $this->fields->repost; ?>
                                </div>
                            <?php endif; ?>
                            <?php $this->content(); ?>
                        </div>
                        <div class="postBody-after">&nbsp;</div>
                    </div>
                </div>
            <?php else: //图册 ?>
                <?php $photos = getCoverList($this); ?>
                <div class="columns">
                    <div class="column col-8 col-sm-12" style="margin:0 auto;">
                        <?php if ($this->fields->repost !== '')://有转载信息 ?>
                            <div style="padding:10px;margin:10px;" class="text-small"> <?php echo $this->fields->repost; ?>
                            </div>
                        <?php endif; ?>
                        <div class="noImgs">
                            <?php $this->content(); ?>
                        </div>
                        <?php if (count($photos) < 1): ?>
                            <div class="text-center">未找到图片</div>
                        <?php endif; ?>
                        <?php foreach ($photos as $index => $photo): ?>
                            <div class="bg-image photo-item" data-data="" data-index="<?php echo $index; ?>"
                                data-src="<?php echo $photo; ?>"
                                style="background-image:url('<?php echo $photo; ?>');width:calc(100% - 20px);height:calc(100vh - 15px);">
                            </div>
                            <div style="margin-bottom:70px; text-align: center;">
                                <div>
                                    <a href="<?php echo $photo; ?>" class="tooltip" data-tooltip="点击看大图" target="_blank">
                                        <div class="-icon -open -larger" style="margin:0 auto;display: inline-block"></div>
                                    </a>
                                </div>
                                <div><?php echo ($index + 1); ?> / <?php echo count($photos); ?></div>
                            </div>
                        <?php endforeach; ?>
                    </div>
                </div>
            <?php endif; ?>
        </div>

        <script>
            (() => {
                const parent = window.parent.length
                if (parent === 0) location.href = '/'

                window.resize = () => {
                    resetItemHeight()
                }

                window.theme = getSystemTheme()
                document.body.setAttribute('data-theme', getSystemTheme());
                window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (event) => {
                    const newTheme = event.matches ? 'dark' : 'light';
                    document.body.setAttribute('data-theme', newTheme);
                });
            })()

            function getImgInfo(t) {
                let exifData = EXIF.getData(t);
                console.log(exifData);
            }

            function getSystemTheme() {
                if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
                    return 'dark';
                } else {
                    return 'light';
                }
            }
        </script>
    </body>

</html>